﻿using Architecture.API.Application.Command.UserInfoCommand;
using Architecture.Domain.Dto.UserInfoDto;
using Architecture.Domain.Service.UserInfoServices;
using MediatR;

namespace Architecture.API.Application.CommandHandlers.UserInfoHandler
{
    /// <summary>
    /// 用户信息搜索命令处理器
    /// </summary>
    public class UserInfoSearchInfoCommandHandler : IRequestHandler<UserInfoSearchInfoCommand, List<UserInfoDtoTwo>>
    {
        /// <summary>
        /// 用户信息服务
        /// </summary>
        private readonly IUserInfoService _userInfoService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userInfoService">用户信息服务</param>
        public UserInfoSearchInfoCommandHandler(IUserInfoService userInfoService)
        {
            _userInfoService = userInfoService;
        }

        /// <summary>
        /// 查询用户信息
        /// </summary>
        /// <param name="request">请求</param>
        /// <param name="cancellationToken">取消标记</param>
        /// <returns>返回用户信息</returns>
        public async Task<List<UserInfoDtoTwo>> Handle(UserInfoSearchInfoCommand request, CancellationToken cancellationToken)
        {
            return await _userInfoService.GetALLInfoAsyncTwo(request.ids);
        }
    }
}
